package cn.edu.hbnu.spoc.controller;

import cn.edu.hbnu.spoc.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * @author sakura
 * @date 2018/03/01 10:36
 */
@Controller
public class MainController {

    private TestService testService;

    @Autowired
    public MainController(TestService testService) {
        this.testService = testService;
    }

    @RequestMapping(value = "test", method = RequestMethod.GET)
    public String test() {
        return "test";
    }

    @RequestMapping(value = "springtest", method = RequestMethod.GET)
    public String springTest() {
        return testService.test();
    }

    @RequestMapping(value = "list", method = RequestMethod.GET)
    @ResponseBody
    public Collection listUsers() {
        return testService.listUsers();
    }
}
